package io.yuncheng.modules;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.Reader;
import java.net.MalformedURLException;
import java.net.URL;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import com.mchange.util.Base64Encoder;
import org.apache.commons.codec.binary.Base64;
import org.codehaus.xfire.XFireFactory;
import org.codehaus.xfire.client.Client;
import org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.binding.ObjectServiceFactory;
import org.w3c.dom.Document;

public class WebTest {


    public static void main(String[] args) {

        Client client;
        try {
            client = new Client(new URL("http://localhost:8280/webservice/orderService?wsdl"));
            //实例化解析器
            DocumentBuilderFactory fac=DocumentBuilderFactory.newInstance();
            DocumentBuilder builder=fac.newDocumentBuilder();
            //DocumentHandler hep=fac.
            //创建dom对象
            String str = "<task>\n" +
                    "\t<user>\n" +
                    "\t\t<oper>add</oper>\n" +
                    "\t\t<!--操作类型（增加用户）-->\n" +
                    "\t\t<id>14000003@gd.zg</id>\n" +
                    "\t\t<!--用户信任号-->\n" +
                    "\t\t<name>张三</name>\n" +
                    "\t\t<!--用户姓名-->\n" +
                    "\t\t<usertype/>\n" +
                    "\t\t<!--用户类型UT01：个人证书用户，UT02：法人证书用户-->\n" +
                    "<grade>秘密</grade>\n" +
                    "<!--用户密级-->\n" +
                    "\t\t<dname>会议处</dname>\n" +
                    "\t\t<!--用户所属机构名称-->\n" +
                    "\t\t<did>34000004@gd.zg </did>\n" +
                    "\t\t<!--用户所属机构标识-->\n" +
                    "\t\t<dorder/>\n" +
                    "\t\t<!--用户排序号-->\n" +
                    "\t\t<dcode/>\n" +
                    "\t\t<!--用户所属机构编码-->\n" +
                    "\t\t<sexual>1</sexual>\n" +
                    "\t\t<!--用户性别1:男，0：女-->\n" +
                    "\t\t<duty/>\n" +
                    "\t\t<!--用户职务-->\n" +
                    "\t\t<post/>\n" +
                    "\t\t<!--用户岗位-->\n" +
                    "\t\t<account/>\n" +
                    "\t\t<!--用户账号-->\n" +
                    "\t\t<password/>\n" +
                    "\t\t<!--用户密码-->\n" +
                    "\t\t<mail/>\n" +
                    "\t\t<!--安全邮箱-->\n" +
                    "\t</user>\n" +
                    "</task>\n";
            //   return builder.toString();
            Object[] results11 = client.invoke("CA_UpdateForSame", new Object[]{str,"0"});
            System.out.println(results11[0]);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }


    }




}


